public class HW3 {
    public static void main(String[] args) {
        int i=1;
        int num=0;
        do {
            if (i%2==0&&i%5==0&&i%7==0){
                System.out.print(i+" ");
                num++;
            if (num%5==0){
                System.out.println();
            }
            }
            i++;
        }while (i<=500);
        System.out.println(num+"个");
    }
}
